<!--#include file="header.htm" -->
<div id="content">

<h1>Dynamic Variables</h1>
<p>One of the most basic needs is to provide status information back to the user of 
your web application.  The HTTP server provides for this using <i>dynamic 
variable substitution callbacks</i>.  These commands in your HTML code will
alert the server to execute a callback function at that point.</p>
<p>To insert a dynamic variable, place the name of the variable inside of the tilde
(<code>~</code>) character, like this: <code>~myVariable~</code>.  When that 
sequence is found, the server will call the function <code>TCPIP_HTTP_Print_myVariable()</code> that was registered dynamically
with the HTTP server.</p>

<p>For example, here's the build date of the HEX file programmed in your part:</p>

<div class="examplebox code">~builddate~</div>

<p>You can also pass parameters to dynamic variables by placing either numeric values
or string of characters inside of parenthesis after the variable name.
<code>~led(2)~</code> will print the value
of the second LED.  The numeric values are passed as int32_t values to your callback function.
The string values are passed as pointers to string of characters.</p>

<p>As an example, here is a binary representation which LEDs are on and off on the board &#40;in the current Harmony release, this part is only working on Explorer 16 board&#41;:</p>

<div class="examplebox code" style="letter-spacing: 10px">
~led(2)~ ~led(1)~ ?
</div>

<p class="exercise"><b>Exercise:</b> Try to add the last (LSB) LED to the output above.</p>

<p>For data output you need only to call the 
<code>TCPIP_HTTP_NET_DynamicWrite</code> function and return.
Longer outputs may be done using successive calls, which prevents the limited buffer space from being 
overrun.</p>

</div>

<script type="text/javascript">
<!--
document.getElementById('hello').innerHTML = "~hellomsg~";
-->
</script>
<!--#include file="footer.htm" -->
